<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>ajax</title>
		<script type="text/javascript">
			function createRequ(){
				var xmlhttp = null;
				if(window.XMLHttpRequest){
					xmlhttp = new XMLHttpRequest();
				}else{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
				}
				return xmlhttp;
			}
			
			//创建XMLHttpRequest对象
			var xmlrequ = null;
			var url = 'chaxun.html';
			
			function queryScore() {
				console.info('11111');
				xmlrequ = createRequ();
				console.info('22222');
				xmlrequ.onreadystatechange = state_Change;
				xmlrequ.open("GET",url,true);
				xmlrequ.send(null);
			}
			
			function state_Change() { 
				if(xmlrequ.readyState==4){
					if(xmlrequ.status == 200) {
						//200 = OK
						document.getElementById('res').innerHTML = xmlrequ.responseText;
					}else{
						alert('系统忙，请稍后重试：Problem retrieving XML data');
					}
				}
			}
			
		</script>
	</head>
	<body>
		<form method="post">
			<input type="text" id="username" value="" />
			<input type="button" value="提交" onclick="queryScore()"/>
		</form>
		<div id="res">
			
		</div>
	</body>
</html>
